package com.xlf.service.ai.common;

import com.xlf.service.ai.enums.Role;
import com.xlf.service.ai.pojo.dto.FunctionCall;
import com.xlf.service.ai.pojo.dto.Message;

/**
 * @Author xlf 2734029211@qq.com
 * @Date 2024/1/29 19:01
 * @Description: TODO
 * @Version 1.0
 */
public class MessageUtils {


    public static Message buildUserMessage(String content) {
        return buildUserMessage(content, null, null);
    }

    public static Message buildAssistantMessage(String content) {
        return buildAssistantMessage(content, null, null);
    }

    public static Message buildUserMessage(String content, String name, FunctionCall functionCall) {

        if (functionCall == null) {
            return new Message(Role.user, content, null, null);
        }

        return new Message(Role.user, content, name, functionCall);
    }

    public static Message buildAssistantMessage(String content, String name, FunctionCall functionCall) {
        return new Message(Role.assistant, content, name, functionCall);
    }
}
